//
//  Header.h
//  Demo
//
//  Created by william on 12-7-30.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#ifndef Common_h
#define Common_h

#define THROW_SINGLETON_EXCEP() [NSException raise:@"Singleton" format:@"You can't create a singleton more than once!"]

#pragma mark ---Singleton Macro---

#define DECLARE_AS_SINGLETON(interfaceName)                          \
+ (interfaceName*)SharedInstance;                                               \

#define DEFINE_SINGLETON(interfaceName)								\
static interfaceName* interfaceName##Instance = nil;                            \
+ (interfaceName*) SharedInstance												\
{                                                                               \
if (interfaceName##Instance == nil)                                         \
interfaceName##Instance = [[interfaceName alloc] init];                 \
return interfaceName##Instance;												\
}

#define INSTANCE_VAR_FOR(interfaceName) (interfaceName##Instance)
#pragma mark ---

#endif

#define MachSysCall(x)  NSCAssert((x) == KERN_SUCCESS, @"Mach system call failed!")
#define CRSay(format,...) NSLog(@"CrashReporter:%@", [NSString stringWithFormat:format, ##__VA_ARGS__]);
